package org.nowcoder.leetcode.twoPointers;

import java.util.Arrays;

/**
 * Title  : 561.Array Partition
 * Source : https://leetcode.cn/problems/array-partition/description/
 * Author : XrazYang
 * Date   : 2023-10-23
 */

public class LeetCode_561 {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int sum = 0;
        for (int i = 0; i < nums.length; i += 2) {
            sum += nums[i];
        }
        return sum;
    }
}
